package BookRack;

public class Book {
    private String title;
    private String author;
    private int price;
    private String type;
    private boolean available;

    //初始化构造方法
    //默认书没有借出去
    public Book(String title, String author, int price, String type) {
        this.title = title;
        this.author = author;
        this.price = price;
        this.type = type;
    }


    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public boolean isAvailable() {
        return available;
    }

    public void setAvailable(boolean available) {
        this.available = available;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }


    //重写toString打印图书信息
    @Override
    public String toString() {
        return "书的信息:"+'\n'+"书的标题是:"+title+'\n'+"书的作者是:"+author+'\n'+"书的价格是:"+price+'\n'+"书的类型是:"+type;
    }
}
